package com.motherchild.admin.service.impl;

import com.motherchild.admin.dto.RoleDTO;
import com.motherchild.admin.mapper.RoleMapper;
import com.motherchild.admin.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleMapper roleMapper;

    @Override
    public List<RoleDTO> getAllRoles() {
        return roleMapper.selectAllRoles();
    }

    @Override
    public RoleDTO getRoleById(Long id) {
        return roleMapper.selectRoleById(id);
    }

    @Override
    public void addRole(RoleDTO roleDTO) {
        roleMapper.insertRole(roleDTO);
    }

    @Override
    public void updateRole(RoleDTO roleDTO) {
        roleMapper.updateRole(roleDTO);
    }

    @Override
    public void deleteRole(Long id) {
        roleMapper.deleteRole(id);
    }
} 